package com.freedom.controller.w.core;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletResponse;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.freedom.bean.core.SysProvince;
import com.freedom.service.core.SysProvinceService;
import com.freedom.util.sys.HtmlUtil;
import com.freedom.vo.w.core.WebVo;

/**
 * 省
 * 
 * @author huguangjun
 *
 */
@Controller
public class SysProvinceController extends BaseWebPaginationCRUDController<WebVo> {

	// 本地异常日志记录对象
	private static final Logger logger = LoggerFactory.getLogger(SysProvinceController.class);
	@Autowired
	private SysProvinceService sysProvinceService;

	@Override
	public String init() {
		// TODO Auto-generated method stub
		return null;
	}

	@RequestMapping("wh004/1")
	public void getSysProvincesByCountryId(HttpServletResponse response) {
		Map<String, Object> map = new HashMap<String, Object>();
		List<SysProvince> sysProvinces = new ArrayList<SysProvince>();
		try {
			map.put("countryId", Integer.valueOf(1));
			sysProvinces = this.sysProvinceService.getSysProvincesByCountryId(map);
		} catch (Exception e) {
			logger.error("错误：",e);
		}
		HtmlUtil.writerJson(response, sysProvinces);
	}
}
